#include<bits/stdc++.h>
using namespace std;
int main(){
	freopen("two.in" , "r" , stdin);
	freopen("two.out" , "w" , stdout);
	int L , R , sum = 0;
	cin >> L >> R;
	int i = L;
	while(i <= R){
		int a , b = i;
		while(b > 0){
			a = b % 10;
			if(a == 2){
				sum = sum + 1;
			} 
			b = b / 10;
		}
		i = i + 1;
	}
	cout << sum << endl;
	return 0;
}
